/**
 * 初始化指标项明细(待定)详情对话框
 */
var SdsQcentityIndexAliasInfoDlg = {
    validateFields: {
    	parref: {
            validators: {
                notEmpty: {
                    message: '病种指标不能为空'
                }
            }
        },
    	subIdxDesc: {
            validators: {
                notEmpty: {
                    message: '指标项名称不能为空'
                }
            }
        },
    	staType: {
            validators: {
                notEmpty: {
                    message: '指标项统计方式不能为空'
                }
            }
        },
    	entityItemDr: {
            validators: {
                notEmpty: {
                    message: '关联病种项目不能为空'
                }
            }
        },
    	calcExpress: {
            validators: {
                notEmpty: {
                    message: '指标项计算公式不能为空'
                }
            }
        },
    	indNo: {
            validators: {
                notEmpty: {
                    message: '序号不能为空'
                }
            }
        },
    	isActive: {
            validators: {
                notEmpty: {
                    message: '是否有效不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
SdsQcentityIndexAliasInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
SdsQcentityIndexAliasInfoDlg.validate = function () {
    $('#sdsQcentityIndexAliasInfoForm').data("bootstrapValidator").resetForm();
    $('#sdsQcentityIndexAliasInfoForm').bootstrapValidator('validate');
    return $("#sdsQcentityIndexAliasInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
SdsQcentityIndexAliasInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcentityIndexAliasInfoForm',Sys.backendPath + "/sds/sdsqcentityindexalias/add",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcentityIndexAlias.table.refresh();
        SdsQcentityIndexAliasInfoDlg.close();
    });
}

/**
 * 提交修改
 */
SdsQcentityIndexAliasInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcentityIndexAliasInfoForm',Sys.backendPath + "/sds/sdsqcentityindexalias/update",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcentityIndexAlias.table.refresh();
        SdsQcentityIndexAliasInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("sdsQcentityIndexAliasInfoForm", SdsQcentityIndexAliasInfoDlg.validateFields);
});
